#include <stdlib.h>
#include "IOdevice.h"


IODevicePtr ioConstructor(int id) {
    IODevicePtr this = (IODevicePtr) malloc(sizeof(IODeviceStr));
    this->id = id;
    this->ioMTX = PTHREAD_MUTEX_INITIALIZER;
    this->ioCV = PTHREAD_COND_INITIALIZER;
    this->ioQueue = queueConstructor();
    return this;
}


void ioDestructor(IODevicePtr this) {
    pthread_cond_destroy(&this->ioCV);
    pthread_mutex_destroy(&this->ioMTX);
    this->ioQueue->destruct(this->ioQueue);
    free(this);
}


